********************************************************************************
clear all
set more off
capture log close

********************************************************************************
** File paths
** Set the current directory to the same folder where the code is

** These are in dropbox
global input "../input" 
global output "../output" 
global temp "../temp"

********************************************************************************
use $temp/pagelength_users_edits, clear
keep if vLanguage == "it" | vLanguage == "fr" | vLanguage == "de" | vLanguage == "nl"
** Length
gen tempLength2014 = vLength if vMonth == tm(2014m7)
gen tempLength2010 = vLength if vMonth == tm(2010m7)
egen vLength2014 = mean(tempLength2014), by(vPage vLanguage)
egen vLength2010 = mean(tempLength2010), by(vPage vLanguage)
sum vLength2014 vLength2010 
** vUsers
gen tempUsers2014 = vUsers if vMonth>=tm(2013m8) & vMonth <= tm(2014m7)
egen vAverUsers2014 = mean(tempUsers2014), by(vPage vLanguage)
gen tempUsers2010 = vUsers if vMonth>=tm(2010m8) & vMonth <= tm(2011m7)
egen vAverUsers2010 = mean(tempUsers2010), by(vPage vLanguage)
keep vPage vLanguage vNumPage vNumLanguage vNumPageID vLength2010 vLength2014 vAverUsers2014 vAverUsers2010 vNumberOfTourists 
duplicates drop 
sum vNumPage vNumLanguage vNumPageID vLength2010 vLength2014 vAverUsers2014 vAverUsers2010 vNumberOfTourists
save $temp/temp_data_for_montecarlo, replace 

********************************************************************************
do power_analysis_montecarlo 1 1 1
do power_analysis_montecarlo 1 1 0

*******************************************************************************
